package net.com.hydroPK.net.packethandler;

import net.com.hydroPK.Engine;
import net.com.hydroPK.model.Player;
import net.com.hydroPK.model.items.*;
import net.com.hydroPK.util.Misc;

/**
 * @author codeusa <codeusa@live.com> <codeusa.net>
 */

public class ItemOnObject {

    /**
     * Class constructor
     */
    public ItemOnObject() {

    }

    /**
     * Item on object
     */
    public void createPacket(Player player) {
        int coordY = player.getByteVector().readSignedWordBigEndian();
        int itemId = player.getByteVector().readUnsignedWord();
        int junk1 = player.getByteVector().readUnsignedWord();
        int junk2 = player.getByteVector().readUnsignedWord();
        int junk3 = player.getByteVector().readUnsignedWord();
        int objectId = player.getByteVector().readUnsignedWordA();
        int coordX = player.getByteVector().readUnsignedWord();
        PlayerItems pi = new PlayerItems();      		    
        switch (objectId) {
	    case 36695:
			if (itemId == 13734 && Engine.playerItems.hasPlayerItemAmount(player, 995, 2500000)) {
                    Engine.playerItems.deleteItem(player, 13734, Engine.playerItems.getItemSlot(player, 13734), 1);
                    Engine.playerItems.addItem(player, 13736, 1);
                    Engine.playerItems.deleteItem(player, 995, Engine.playerItems.getItemSlot(player, 995), 2500000);
		    player.teleportTo(2852, 2957, 0, 7, 0, 9603, -1, 569, 0, -1, 0);
		player.message("as you put the Spirit Shield into the Foundain, you feel it become blessed!");
		} else {
		player.message("you need 2.5M to do this.");
		    player.teleportTo(2852, 2957, 0, 7, 0, 9603, -1, 569, 0, -1, 0);
		}
			break;
	    case 885:
			if (itemId == 1917) {
			player.requestAnim(725, 0);
                    Engine.playerItems.deleteItem(player, 1919, 1);
                    Engine.playerItems.addItem(player, 1917, 1);
		player.getActionSender().sendMessage(player, "you refill your Glass with Beer.");
			}
			break;

            case 24283:
			if (itemId == 317) {
				player.cookXP = 600;
				player.cookID = 317;
				player.cookGet = 315;
				player.Cooking = true;
				player.cookName = "Shrimp";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			}
			if (itemId == 321) {
				player.cookXP = 600;
				player.cookID = 321;
				player.cookGet = 319;
				player.Cooking = true;
				player.cookName = "Anchovie";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			}
			if (itemId == 327) {
				player.cookXP = 800;
				player.cookID = 327;
				player.cookGet = 325;
				player.Cooking = true;
				player.cookName = "Sardine";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			}
			if (itemId == 335) {
			    if (player.skillLvl[7] < 15) {
				player.getActionSender().sendMessage(player, "You need level 15 Cooking to cook Trout.");
			    } else {
				player.cookXP = 1400;
				player.cookID = 335;
				player.cookGet = 333;
				player.Cooking = true;
				player.cookName = "Trout";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 349) {
			    if (player.skillLvl[7] < 20) {
				player.getActionSender().sendMessage(player, "You need level 20 Cooking to cook Pike.");
			    } else {
				player.cookXP = 1600;
				player.cookID = 349;
				player.cookGet = 351;
				player.Cooking = true;
				player.cookName = "Pike";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 331) {
			    if (player.skillLvl[7] < 25) {
				player.getActionSender().sendMessage(player, "You need level 25 Cooking to cook Salmon.");
			    } else {
				player.cookXP = 1800;
				player.cookID = 331;
				player.cookGet = 329;
				player.Cooking = true;
				player.cookName = "Salmon";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 359) {
			    if (player.skillLvl[7] < 30) {
				player.getActionSender().sendMessage(player, "You need level 30 Cooking to cook Tuna.");
			    } else {
				player.cookXP = 2000;
				player.cookID = 359;
				player.cookGet = 361;
				player.Cooking = true;
				player.cookName = "Tuna";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 377) {
			    if (player.skillLvl[7] < 40) {
				player.getActionSender().sendMessage(player, "You need level 40 Cooking to cook Lobster.");
			    } else {
				player.cookXP = 2400;
				player.cookID = 377;
				player.cookGet = 379;
				player.Cooking = true;
				player.cookName = "Lobster";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 363) {
			    if (player.skillLvl[7] < 43) {
				player.getActionSender().sendMessage(player, "You need level 43 Cooking to cook Bass.");
			    } else {
				player.cookXP = 1525;
				player.cookID = 363;
				player.cookGet = 365;
				player.Cooking = true;
				player.cookName = "Bass";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 371) {
			    if (player.skillLvl[7] < 45) {
				player.getActionSender().sendMessage(player, "You need level 45 Cooking to cook Swordfish.");
			    } else {
				player.cookXP = 2800;
				player.cookID = 371;
				player.cookGet = 373;
				player.Cooking = true;
				player.cookName = "Swordfish";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 7944) {
			    if (player.skillLvl[7] < 62) {
				player.getActionSender().sendMessage(player, "You need level 62 Cooking to cook Monkfish.");
			    } else {
				player.cookXP = 3200;
				player.cookID = 7944;
				player.cookGet = 7946;
				player.Cooking = true;
				player.cookName = "Monkfish";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 383) {
			    if (player.skillLvl[7] < 80) {
				player.getActionSender().sendMessage(player, "You need level 80 Cooking to cook Shark.");
			    } else {
				player.cookXP = 4000;
				player.cookID = 383;
				player.cookGet = 385;
				player.Cooking = true;
				player.cookName = "Shark";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
			if (itemId == 389) {
			    if (player.skillLvl[7] < 91) {
				player.getActionSender().sendMessage(player, "You need level 91 Cooking to cook Manta ray.");
			    } else {
				player.cookXP = 5000;
				player.cookID = 389;
				player.cookGet = 391;
				player.Cooking = true;
				player.cookName = "Manta ray";
				//player.getActionSender().removeChatboxInterface(player);
				//player.getActionSender().showChatboxInterface(player, 307);
				//player.getActionSender().addInterfaceItem(player, 307, 2, 175, player.cookID);
				//player.getActionSender().setString(player, ""+ player.cookName +"", 307, 4);
			    }
			}
                            break;
            case 2783:
                if (itemId == 2349) {
                            if (pi.invItemCount(player, 2347) >=1) {
                            player.smithing.smithing(player, 1);
                            } else {
                                player.getActionSender().sendMessage(player, "you need a hammer to smith this");
                            }
                        }
                if (itemId == 2351) {
                           if (player.skillLvl[13] >=15) {
                            if (pi.invItemCount(player, 2347) >=1) {
                            player.smithing.smithing(player, 2);
                            } else {
                                player.getActionSender().sendMessage(player, "you need a hammer to smith this");
                            }
                            } else {
                               player.getActionSender().sendMessage(player, "you need a smithing level of 15 to smith this bar.");
                           }
                        }
                        if (itemId == 2353) {
                           if (player.skillLvl[13] >=35) {
                            if (pi.invItemCount(player, 2347) >=1) {
                            player.smithing.smithing(player, 3);
                            } else {
                                player.getActionSender().sendMessage(player, "you need a hammer to smith this");
                            }
                            } else {
                               player.getActionSender().sendMessage(player, "you need a smithing level of 35 to smith this bar.");
                           }
                        }

                        if (itemId == 2359) {
                           if (player.skillLvl[13] >=55) {
                            if (pi.invItemCount(player, 2347) >=1) {
                            player.smithing.smithing(player, 4);
                            } else {
                                player.getActionSender().sendMessage(player, "you need a hammer to smith this");
                            }
                            } else {
                               player.getActionSender().sendMessage(player, "you need a smithing level of 55 to smith this bar.");
                           }
                        }

                        if (itemId == 2361) {
                           if (player.skillLvl[13] >=70) {
                            if (pi.invItemCount(player, 2347) >=1) {
                            player.smithing.smithing(player, 5);
                            } else {
                                player.getActionSender().sendMessage(player, "you need a hammer to smith this");
                            }
                            } else {
                               player.getActionSender().sendMessage(player, "you need a smithing level of 70 to smith this bar.");
                           }
                        }

                        if (itemId == 2363) {
                           if (player.skillLvl[13] >=85) {
                            if (pi.invItemCount(player, 2347) >=1) {
                            player.smithing.smithing(player, 6);
                            } else {
                                player.getActionSender().sendMessage(player, "you need a hammer to smith this");
                            }
                            } else {
                               player.getActionSender().sendMessage(player, "you need a smithing level of 85 to smith this bar.");
                           }
                        }
                break;
                /**
                 * ALL OF THE DROP PARTY STUFF
                 **/
            case 10311://object ID
            	if (itemId == 1755) {//chisel
            		if (player.rights >= 2) {
            			player.requestAnim(2140, 0);
            			int randomdrop = Misc.random(1);
            			if (randomdrop == 0) {
            				Engine.items.createGroundItem(995, 10000000, 2986, 9631, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13887, 1, 2988, 9634, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3481, 1, 2991, 9631, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3483, 1, 2985, 9635, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3485, 1, 2989, 9639, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3487, 1, 2988, 9644, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3489, 1, 2984, 9642, player.heightLevel, player.username);
            				Engine.items.createGroundItem(11848, 1, 2987, 9637, player.heightLevel, player.username);
            				Engine.items.createGroundItem(11850, 1, 2993, 9640, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13893, 1, 2990, 9631, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13899, 1, 2983, 9634, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13884, 1, 2988, 9641, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13896, 1, 2986, 9634, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13902, 1, 2990, 9636, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13890, 1, 2983, 9633, player.heightLevel, player.username);
            				Engine.items.createGroundItem(14484, 1, 2988, 9639, player.heightLevel, player.username);
            				Engine.items.createGroundItem(14479, 1, 2987, 9632, player.heightLevel, player.username);
            				Engine.items.createGroundItem(11335, 1, 2982, 9632, player.heightLevel, player.username);
            				Engine.items.createGroundItem(1038, 1, 2984, 9639, player.heightLevel, player.username);
            				Engine.items.createGroundItem(1044, 1, 2993, 9641, player.heightLevel, player.username);
            			} else if (randomdrop == 1) {
            				Engine.items.createGroundItem(995, 10000000, 2986, 9631, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13887, 1, 2988, 9634, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3481, 1, 2991, 9631, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3483, 1, 2985, 9635, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3485, 1, 2989, 9639, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3487, 1, 2988, 9644, player.heightLevel, player.username);
            				Engine.items.createGroundItem(3489, 1, 2984, 9642, player.heightLevel, player.username);
            				Engine.items.createGroundItem(11848, 1, 2987, 9637, player.heightLevel, player.username);
            				Engine.items.createGroundItem(11850, 1, 2993, 9640, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13893, 1, 2990, 9631, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13899, 1, 2983, 9634, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13884, 1, 2988, 9641, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13896, 1, 2986, 9634, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13902, 1, 2990, 9636, player.heightLevel, player.username);
            				Engine.items.createGroundItem(13890, 1, 2983, 9633, player.heightLevel, player.username);
            				Engine.items.createGroundItem(14484, 1, 2988, 9639, player.heightLevel, player.username);
            				Engine.items.createGroundItem(14479, 1, 2987, 9632, player.heightLevel, player.username);
            				Engine.items.createGroundItem(11335, 1, 2982, 9632, player.heightLevel, player.username);
            				Engine.items.createGroundItem(1038, 1, 2984, 9639, player.heightLevel, player.username);
            				Engine.items.createGroundItem(1044, 1, 2993, 9641, player.heightLevel, player.username);
            			}
            		} else {
            			player.getActionSender().sendMessage(player, "Sorry, only admins can use this.");
            		}
            	}
            	break;

            default:
                player.getActionSender().sendMessage(player, "itemId: " + itemId);
                player.getActionSender().sendMessage(player, "objectId " + objectId);
                break;
        }

    }
    }
	